package HomeWork.HomeWork11.Animal;

/***/
public class Test {
    public static void main(String[] args) {
        /*Animal cat = new cat();
        doTest1(cat);

        Animal dog = new Dog();
        doTest1(dog);*/
        doTest2();

    }

    public static void doTest1(Animal animal){
        animal.eat();
        if (animal instanceof cat){
            ((cat) animal).catchMouse();
        }else if (animal instanceof Dog){
            ((Dog) animal).keepHome();
        }
    }

    public static Animal doTest2(){
        Animal cat = new cat();
        doTest1(cat);
        return cat;
    }
}
